// 导入vue
import Vue from 'vue'
// 导入vue-router
import VueRouter from 'vue-router'

//集成vuerouter中间件
Vue.use(VueRouter)

// 导入Login
import Login from '../components/accout/Login'
import Layout from '../components/layout/Layout'
import Users from '../components/users/Users'
import Welcome from '../components/welcome/Welcome'

// 创建路由对象,并导出去
const router = new VueRouter({
    routes:[
        {path:'/',redirect:'/login'},
        {path:'/login',component:Login},
        {path:'/layout',component:Layout,children:[
            {path:'',component:Welcome},
            {path:'users',component:Users}//嵌套路由中的path中不用家/
        ]}
    ]
})

// 导出这个路由
export default router